let clang-tidy provide default member initializers (#562)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Wed, 20 May 2020 16:17:55 +0000 (10:17 -0600)
committerGitHub <noreply@github.com>
Wed, 20 May 2020 16:17:55 +0000 (10:17 -0600)
* let clang-tidy provide default memeber intializers

This is the check cppcoreguidelines-pro-type-member-init, but
it was only applied to the class declarations for our filters,
formats and vectors.
This is currently irrelevant as all these are constructed globally,
but if one constructs dynamic instances errors can be seen in gpx, kml, nmea
and lowranceusr formats.

* revert filter_vecs change which MSVC 2015 choked on.

19 files changed:
arcdist.h
bend.h
discard.h
gpx.h
height.h
lowranceusr.h
nmea.h
nukedata.h
position.h
qstarz_bl_1000.h
radius.h
reverse_route.h
shape.h
smplrout.h
sort.h
trackfilter.h
transform.h
validate.h
yahoo.h

index ba0be89d47e10212567337141e8ec511b686985b..b70628b364ea94693b05087a7de1646e7241f782 100644 (file)
--- a/arcdist.h
+++ b/arcdist.h
@@ -40,7 +40,7 @@ public:
   void process() override;
 
 private:
-  double pos_dist;
+  double pos_dist{};
   char* distopt = nullptr;
   char* arcfileopt = nullptr;
   char* rteopt = nullptr;
diff --git a/bend.h b/bend.h
index 643051df6b9e65ac8f8ef363388832d723ce9107..88f1abca186657f3603daf65052253d95d8091ba 100644 (file)
--- a/bend.h
+++ b/bend.h
@@ -45,8 +45,8 @@ private:
   char* distopt = nullptr;
   char* minangleopt = nullptr;
 
-  double maxDist;
-  double minAngle;
+  double maxDist{};
+  double minAngle{};
 
   RouteList* routes_orig = nullptr;
 
index 76f8e8167ed8ff8112c04809bff2bd863ffd7bd1..fd6b369cb18d09f6b9d9d7dc4fe385be159c44a9 100644 (file)
--- a/discard.h
+++ b/discard.h
@@ -58,13 +58,13 @@ private:
   char* iconopt = nullptr;
   QRegExp icon_regex;
 
-  double hdopf;
-  double vdopf;
-  int satpf;
-  int eleminpf;
-  int elemaxpf;
+  double hdopf{};
+  double vdopf{};
+  int satpf{};
+  int eleminpf{};
+  int elemaxpf{};
   gpsdata_type what;
-  route_head* head;
+  route_head* head{};
 
   QVector<arglist_t> args = {
     {
diff --git a/gpx.h b/gpx.h
index 1500d7eaef960cc968a5530fb02f77a2ae1d3732..4b9bc1a934c8cb25bda06d6f066112d734b88f86 100644 (file)
--- a/gpx.h
+++ b/gpx.h
@@ -229,15 +229,15 @@ private:
   void gpx_waypt_bound_calc(const Waypoint* waypointp);
   void gpx_write_bounds();
 
-  QXmlStreamReader* reader;
-  xml_tag* cur_tag;
+  QXmlStreamReader* reader{};
+  xml_tag* cur_tag{};
   QString cdatastr;
   char* opt_logpoint = nullptr;
   char* opt_humminbirdext = nullptr;
   char* opt_garminext = nullptr;
   char* opt_elevation_precision = nullptr;
   int logpoint_ct = 0;
-  int elevation_precision;
+  int elevation_precision{};
 
   // to check if two numbers are equivalent use normalized values.
   const QVersionNumber gpx_1_0 = QVersionNumber(1,0).normalized();
@@ -249,14 +249,14 @@ private:
 
   QString current_tag;
 
-  Waypoint* wpt_tmp;
-  UrlLink* link_;
-  UrlLink* rh_link_;
-  bool cache_descr_is_html;
-  gpsbabel::File* iqfile;
-  gpsbabel::File* oqfile;
-  gpsbabel::XmlStreamWriter* writer;
-  short_handle mkshort_handle;
+  Waypoint* wpt_tmp{};
+  UrlLink* link_{};
+  UrlLink* rh_link_{};
+  bool cache_descr_is_html{};
+  gpsbabel::File* iqfile{};
+  gpsbabel::File* oqfile{};
+  gpsbabel::XmlStreamWriter* writer{};
+  short_handle mkshort_handle{};
   QString link_url;
   QString link_text;
   QString link_type;
@@ -265,14 +265,14 @@ private:
   char* snlen = nullptr;
   char* suppresswhite = nullptr;
   char* urlbase = nullptr;
-  route_head* trk_head;
-  route_head* rte_head;
-  const route_head* current_trk_head;          // Output.
+  route_head* trk_head{};
+  route_head* rte_head{};
+  const route_head* current_trk_head{};                // Output.
   /* used for bounds calculation on output */
-  bounds all_bounds;
-  int next_trkpt_is_new_seg;
+  bounds all_bounds{};
+  int next_trkpt_is_new_seg{};
 
-  FormatSpecificDataList* fs_ptr;
+  FormatSpecificDataList* fs_ptr{};
 
   /*
    * The file-level information.
index 9a6080b7cccab0428d259e06b2c155b14ae530b9..0339d800db79fd2be2b4d5f23d15ebef868fdb75 100644 (file)
--- a/height.h
+++ b/height.h
@@ -46,7 +46,7 @@ public:
 private:
   char* addopt        = nullptr;
   char* wgs84tomslopt = nullptr;
-  double addf;
+  double addf{};
   // include static constexpr data member definitions with intializers for grid as private members.
   #include "heightgrid.h"
 
index 1505fbfb18694af5f191cc39c86d3e0a70ca78d4..6ac4e66d0e62fde47ba6718a86dc248231f607ef 100644 (file)
@@ -452,37 +452,37 @@ private:
 
   /* Data Members */
 
-  gbfile*        file_in;
-  gbfile*        file_out;
-  short_handle   mkshort_handle;
-
-  route_head*    trk_head;
-  route_head*    rte_head;
-
-  int            waypt_uid;
-  int            route_uid;
-  int            trail_uid;
-
-  char*          opt_ignoreicons;
-  char*          opt_writeasicons;
-  char*          opt_seg_break;
-  char*          opt_wversion;
-  char*          opt_title;
-  char*          opt_content_descr;
-  char*          opt_serialnum;
-  int            opt_serialnum_i;
+  gbfile*        file_in{};
+  gbfile*        file_out{};
+  short_handle   mkshort_handle{};
+
+  route_head*    trk_head{};
+  route_head*    rte_head{};
+
+  int            waypt_uid{};
+  int            route_uid{};
+  int            trail_uid{};
+
+  char*          opt_ignoreicons{};
+  char*          opt_writeasicons{};
+  char*          opt_seg_break{};
+  char*          opt_wversion{};
+  char*          opt_title{};
+  char*          opt_content_descr{};
+  char*          opt_serialnum{};
+  int            opt_serialnum_i{};
 
   QList<const Waypoint*>* waypt_table{nullptr};
 
-  unsigned short waypt_out_count;
-  int            trail_count, lowrance_route_count;
-  int            trail_point_count;
+  unsigned short waypt_out_count{};
+  int            trail_count{}, lowrance_route_count{};
+  int            trail_point_count{};
   char           continuous = 1;
-  short          num_section_points;
-  char*          merge;
-  int            reading_version;
-  int            rstream_version;
-  int            writing_version;
+  short          num_section_points{};
+  char*          merge{};
+  int            reading_version{};
+  int            rstream_version{};
+  int            writing_version{};
   QTextCodec*    utf16le_codec{nullptr};
 
   template <typename T>
diff --git a/nmea.h b/nmea.h
index f09b988fa66164c3c999f3844bc3e30b395fd949..98624269c9e25c0b91aaed633d19a79332c2b9c6 100644 (file)
--- a/nmea.h
+++ b/nmea.h
@@ -126,47 +126,47 @@ private:
 
   /* Data Members */
 
-  gbfile* file_in, *file_out;
-  route_head* trk_head;
-  short_handle mkshort_handle;
+  gbfile* file_in{}, *file_out{};
+  route_head* trk_head{};
+  short_handle mkshort_handle{};
   preferred_posn_type posn_type;
-  struct tm tm;
-  Waypoint* curr_waypt;
-  Waypoint* last_waypt;
-  void* gbser_handle;
+  struct tm tm{};
+  Waypoint* curr_waypt{};
+  Waypoint* last_waypt{};
+  void* gbser_handle{};
   QString posn_fname;
   QList<Waypoint*> pcmpt_head;
 
-  int without_date;    /* number of created trackpoints without a valid date */
-  struct tm opt_tm;    /* converted "date" parameter */
-
-  char* opt_gprmc;
-  char* opt_gpgga;
-  char* opt_gpvtg;
-  char* opt_gpgsa;
-  char* snlenopt;
-  char* optdate;
-  char* getposnarg;
-  char* opt_sleep;
-  char* opt_baud;
-  char* opt_append;
-  char* opt_gisteq;
-  char* opt_ignorefix;
-
-  long sleepus;
-  int getposn;
-  int append_output;
-  bool amod_waypoint;
-
-  time_t last_time;
-  double last_read_time;   /* Last timestamp of GGA or PRMC */
-  int datum;
-  int had_checksum;
+  int without_date{};  /* number of created trackpoints without a valid date */
+  struct tm opt_tm{};  /* converted "date" parameter */
+
+  char* opt_gprmc{};
+  char* opt_gpgga{};
+  char* opt_gpvtg{};
+  char* opt_gpgsa{};
+  char* snlenopt{};
+  char* optdate{};
+  char* getposnarg{};
+  char* opt_sleep{};
+  char* opt_baud{};
+  char* opt_append{};
+  char* opt_gisteq{};
+  char* opt_ignorefix{};
+
+  long sleepus{};
+  int getposn{};
+  int append_output{};
+  bool amod_waypoint{};
+
+  time_t last_time{};
+  double last_read_time{};   /* Last timestamp of GGA or PRMC */
+  int datum{};
+  int had_checksum{};
 
   Waypoint* nmea_rd_posn(posn_status*);
   void nmea_rd_posn_init(const QString& fname);
 
-  int wpt_not_added_yet;
+  int wpt_not_added_yet{};
 
   QVector<arglist_t> nmea_args = {
     {"snlen", &snlenopt, "Max length of waypoint name to write", "6", ARGTYPE_INT, "1", "64", nullptr },
index e6fe6bea0f7e407bd7b44518415874e887f2c5b7..30ee59715bd483d0a7c8552609b8795bdaf97de6 100644 (file)
@@ -40,9 +40,9 @@ public:
   void process() override;
 
 private:
-  char* nukewpts;
-  char* nuketrks;
-  char* nukertes;
+  char* nukewpts{};
+  char* nuketrks{};
+  char* nukertes{};
 
   QVector<arglist_t> args = {
     {
index a7622c83b66720615aedf9b61edd4eb41c40d2c3..c7e66191925666e1c447c614649a6f1a5fd8c15e 100644 (file)
@@ -42,12 +42,12 @@ public:
 private:
   route_head* cur_rte = nullptr;
 
-  double pos_dist;
-  double max_diff_time;
+  double pos_dist{};
+  double max_diff_time{};
   char* distopt = nullptr;
   char* timeopt = nullptr;
   char* purge_duplicates = nullptr;
-  bool check_time;
+  bool check_time{};
 
   QVector<arglist_t> args = {
     {
index 67cb60d86a2f3cff4014e74fdc9aa38c847a42d0..695cd8314e5d77996a0115a2eedaed2581cf500f 100644 (file)
@@ -43,13 +43,13 @@ struct qstarz_bl_1000_fsdata : FormatSpecificData {
     return new qstarz_bl_1000_fsdata(*this);
   }
 
-  char rcr; // record reason. possible values are listed in switch-case in .cc file
-  float accelerationX; // horizonal acceleration value measured in acceleration due to gravity or g
-  float accelerationY; // vertical acceleration value measured in acceleration due to gravity or g
-  float accelerationZ; // depth acceleration value measured in acceleration due to gravity or g
-  quint16 maxSNR;
-  qint8 satTotal; // satellite count (view)
-  quint8 batteryPercent;
+  char rcr{}; // record reason. possible values are listed in switch-case in .cc file
+  float accelerationX{}; // horizonal acceleration value measured in acceleration due to gravity or g
+  float accelerationY{}; // vertical acceleration value measured in acceleration due to gravity or g
+  float accelerationZ{}; // depth acceleration value measured in acceleration due to gravity or g
+  quint16 maxSNR{};
+  qint8 satTotal{}; // satellite count (view)
+  quint8 batteryPercent{};
 };
 
 class QstarzBL1000Format : public Format
index 75f5a5ca39bb6dba311d9359691f03eb22a07e6d..304f8db41881be64310ed89f21b51e8509341d53 100644 (file)
--- a/radius.h
+++ b/radius.h
@@ -41,7 +41,7 @@ public:
   void deinit() override;
 
 private:
-  double pos_dist;
+  double pos_dist{};
   char* distopt = nullptr;
   char* latopt = nullptr;
   char* lonopt = nullptr;
@@ -49,9 +49,9 @@ private:
   char* nosort = nullptr;
   char* maxctarg = nullptr;
   char* routename = nullptr;
-  int maxct;
+  int maxct{};
 
-  Waypoint* home_pos;
+  Waypoint* home_pos{};
 
   struct extra_data {
     double distance;
index 4550a7df2ec743ab754d87e25e755a89102ca243..3ad948d557959eced1bcd73030483b745b33a623 100644 (file)
@@ -39,7 +39,7 @@ public:
   void process() override;
 
 private:
-  int prev_new_trkseg;
+  int prev_new_trkseg{};
   QVector<arglist_t> args = {
   };
 
diff --git a/shape.h b/shape.h
index 29419709a5a08e9bd0bce9c2f320b5524aeae3bb..0ce05af7cdef6c3c7033e46a4fc61d7b0c43dfe0 100644 (file)
--- a/shape.h
+++ b/shape.h
@@ -79,18 +79,18 @@ private:
   void poly_point(const Waypoint* wpt);
   void poly_deinit(const route_head* rte);
 
-  SHPHandle ihandle;
-  DBFHandle ihandledb;
-  SHPHandle ohandle;
-  DBFHandle ohandledb;
-
-  int poly_count;
-  double* polybufx;
-  double* polybufy;
-  double* polybufz;
+  SHPHandle ihandle{};
+  DBFHandle ihandledb{};
+  SHPHandle ohandle{};
+  DBFHandle ohandledb{};
+
+  int poly_count{};
+  double* polybufx{};
+  double* polybufy{};
+  double* polybufz{};
   QString ifname;
   QString ofname;
-  int nameFieldIdx;    // the field index of the field with fieldName "name" in the output DBF.
+  int nameFieldIdx{};  // the field index of the field with fieldName "name" in the output DBF.
 
   char* opt_name = nullptr;
   char* opt_url = nullptr;
index 928646ec86d8804d8044be63a23c101204d388a9..a1bcce5c22337ec96644c12c895f68f40e6d9fe2 100644 (file)
@@ -87,7 +87,7 @@ private:
   char* xteopt = nullptr;
   char* lenopt = nullptr;
   char* relopt = nullptr;
-  void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt);
+  void (*waypt_del_fnp)(route_head* rte, Waypoint* wpt){};
 
   QVector<arglist_t> args = {
     {
diff --git a/sort.h b/sort.h
index 4c031e47bea1fc7cecefb99d9d432e090d9792f7..79131d9b4734ebb6dae8f6e169f7fa5d2251d9f9 100644 (file)
--- a/sort.h
+++ b/sort.h
@@ -60,9 +60,9 @@ private:
   SortModeRteHd rte_sort_mode = SortModeRteHd::none;   /* How are we sorting these? */
   SortModeRteHd trk_sort_mode = SortModeRteHd::none;   /* How are we sorting these? */
 
-  char* opt_sm_gcid, *opt_sm_shortname, *opt_sm_description, *opt_sm_time;
-  char* opt_sm_rtenum, *opt_sm_rtename, *opt_sm_rtedesc;
-  char* opt_sm_trknum, *opt_sm_trkname, *opt_sm_trkdesc;
+  char* opt_sm_gcid{}, *opt_sm_shortname{}, *opt_sm_description{}, *opt_sm_time{};
+  char* opt_sm_rtenum{}, *opt_sm_rtename{}, *opt_sm_rtedesc{};
+  char* opt_sm_trknum{}, *opt_sm_trkname{}, *opt_sm_trkdesc{};
 
   QVector<arglist_t> args = {
     {
index 2261bfbf869dd7fdf6e83cd109783a67b48a2a0b..078991f1f973fff464efa8681a86967b91f600a7 100644 (file)
@@ -175,7 +175,7 @@ private:
   QList<route_head*> track_list;
   int opt_interval = 0;
   int opt_distance = 0;
-  bool need_time;              /* initialized within trackfilter_init */
+  bool need_time{};            /* initialized within trackfilter_init */
 
   int trackfilter_opt_count();
   qint64 trackfilter_parse_time_opt(const char* arg);
index 62949ad822ea344ebafcc540ad638c345a87874a..34c12efde37845cb5b88c1dbabaf09410e9a7b62 100644 (file)
@@ -41,14 +41,14 @@ public:
   void process() override;
 
 private:
-  char current_target;
-  route_head* current_trk;
-  route_head* current_rte;
+  char current_target{};
+  route_head* current_trk{};
+  route_head* current_rte{};
 
-  char* opt_routes, *opt_tracks, *opt_waypts, *opt_delete, *rpt_name_digits, *opt_rpt_name;
+  char* opt_routes{}, *opt_tracks{}, *opt_waypts{}, *opt_delete{}, *rpt_name_digits{}, *opt_rpt_name{};
   QString current_namepart;
 
-  int name_digits, use_src_name;
+  int name_digits{}, use_src_name{};
 
   const QString RPT = "RPT";
 
index 69ac3bb8547e0b7c74bd546ad49390ee49351dde..e8fbfedc3e3c066b2352e0d68496b4958abe0a3b 100644 (file)
@@ -40,14 +40,14 @@ public:
   void process() override;
 
 private:
-  char* opt_debug;
-  bool debug;
-  char* opt_checkempty;
-  bool checkempty;
-  unsigned int point_ct;
-  unsigned int head_ct;
-  unsigned int segment_ct_start;
-  const char* segment_type;
+  char* opt_debug{};
+  bool debug{};
+  char* opt_checkempty{};
+  bool checkempty{};
+  unsigned int point_ct{};
+  unsigned int head_ct{};
+  unsigned int segment_ct_start{};
+  const char* segment_type{};
   QVector<arglist_t> args = {
     {
       "checkempty", &opt_checkempty, "Check for empty input",
diff --git a/yahoo.h b/yahoo.h
index 16d846afb46d3bb330d002026d15ffedf80ea05a..f3bf2dd9d5741a14dffc26d15cde9c327de7e27a 100644 (file)
--- a/yahoo.h
+++ b/yahoo.h
@@ -67,8 +67,8 @@ public:
   void rd_deinit() override;
 
 private:
-  Waypoint* wpt_tmp;
-  char* as;
+  Waypoint* wpt_tmp{};
+  char* as{};
 
   QVector<arglist_t> yahoo_args = {
     {